#cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.5)
project(avp_slam)
message("start make avp_slam")

# 一定要加-march=native， 不然使用pcl的一些函数会报错
#add_definitions(-DCPP11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
set(CMAKE_CXX_STANDARD 17)

find_package(OpenMP)
if (OPENMP_FOUND)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif ()

find_package(catkin REQUIRED COMPONENTS
        tf
        roscpp
        rospy
        pcl_ros
        pcl_conversions
        nav_msgs
        std_msgs
        sensor_msgs
        geometry_msgs
        cv_bridge
        image_transport
        message_filters # Topic同步
        )

set(ALL_TARGET_LIBRARIES "")
include(cmake/eigen.cmake)
include(cmake/glog.cmake)
include(cmake/YAML.cmake)
include(cmake/global_defination.cmake)
include(cmake/PCL.cmake)
include(cmake/OpenCV.cmake)
include(cmake/boost.cmake)
include(cmake/Sophus.cmake)

catkin_package()

include_directories(
        ${PROJECT_SOURCE_DIR}
        ${PROJECT_SOURCE_DIR}/include
        ${catkin_INCLUDE_DIRS}
)


file(GLOB_RECURSE ALL_SRCS "*.cpp")
file(GLOB_RECURSE NODE_SRCS "nodecpp/*.cpp")
#file(GLOB_RECURSE THIRD_PARTY_SRCS "Thirdparty/*.cpp")
list(REMOVE_ITEM ALL_SRCS ${NODE_SRCS})
#list(REMOVE_ITEM ALL_SRCS ${THIRD_PARTY_SRCS})


# lidar slam and localize
add_executable(data_pretreat_node nodecpp/data_pretreat_node.cpp ${ALL_SRCS})
target_link_libraries(data_pretreat_node ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES})

add_executable(matching_node nodecpp/matching_node.cpp ${ALL_SRCS})
target_link_libraries(matching_node ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES})